package com.qianfeng.qlm.handforireader.model;

import com.android.volley.toolbox.JsonObjectRequest;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by LinXiangLin on 2015/3/25.
 */
public class NewChapterList {

    List<NewChapter> newChapterList;

    public void parseJson(JSONObject jsonObject){
        if (jsonObject != null){

            try {
                JSONArray comicOrderArr = jsonObject.getJSONArray("comic_order_arr");
                if (comicOrderArr != null){
                    newChapterList = new ArrayList<>();
                    for (int i = 0;i < comicOrderArr.length();i++){
                        NewChapter newChapter = new NewChapter();
                        JSONObject comicOrderArrJSONObject = comicOrderArr.getJSONObject(i);
                        newChapter.parseJson(comicOrderArrJSONObject);
                        newChapterList.add(newChapter);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    }

    public List<NewChapter> getNewChapterList() {
        return newChapterList;
    }

    public void setNewChapterList(List<NewChapter> newChapterList) {
        this.newChapterList = newChapterList;
    }
}
